//
//  YTYunTaiHead.m
//  YUNT
//
//  Created by 梁炜东 on 2017/11/21.
//  Copyright © 2017年 梁炜东. All rights reserved.
//

#import "YTYunTaiHead.h"

@interface YTYunTaiHead()
@property(nonatomic, strong)UILabel *titleLabel;
@property(nonatomic, strong)UILabel *subLabel1;
@property(nonatomic, strong)UILabel *subLabel2;
@end

@implementation YTYunTaiHead

-(instancetype)init
{
    self = [super init];
    if (self)
    {
        self.backgroundColor = [UIColor clearColor];
        [self addSubview:self.titleLabel];
        [self addSubview:self.subLabel1];
        [self addSubview:self.subLabel2];
        UIView *line = [[UIView alloc] init];
        line.backgroundColor = YTColorAlpha(210, 210, 210, 0.3);
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.trailing.bottom.equalTo(self);
            make.height.mas_equalTo(1);
        }];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.trailing.equalTo(self);
            make.leading.equalTo(self).offset(10);
            make.height.mas_equalTo(39);
        }];
        [_subLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(self).offset(-10);
            make.centerY.height.equalTo(_titleLabel);
            make.width.mas_equalTo(70);
        }];
        [_subLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.trailing.equalTo(_subLabel2.mas_leading).offset(-22);
            make.centerY.height.equalTo(_titleLabel);
            make.width.mas_equalTo(70);
        }];
        
    }
    return self;
}
-(UILabel *)titleLabel
{
    if (!_titleLabel)
    {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = [UIColor clearColor];
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.textColor = YTColor(160, 160, 160);
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}
-(UILabel *)subLabel1
{
    if (!_subLabel1)
    {
        _subLabel1 = [[UILabel alloc] init];
        _subLabel1.backgroundColor = [UIColor clearColor];
        _subLabel1.font = [UIFont systemFontOfSize:15];
        _subLabel1.textColor = YTColor(160, 160, 160);
        _subLabel1.textAlignment = NSTextAlignmentCenter;
        _subLabel1.text = Language(@"平滑");
        _subLabel1.hidden = YES;
    }
    return _subLabel1;
}
-(UILabel *)subLabel2
{
    if (!_subLabel2)
    {
        _subLabel2 = [[UILabel alloc] init];
        _subLabel2.backgroundColor = [UIColor clearColor];
        _subLabel2.font = [UIFont systemFontOfSize:15];
        _subLabel2.textColor = YTColor(160, 160, 160);
        _subLabel2.textAlignment = NSTextAlignmentCenter;
        _subLabel2.text = Language(@"速度");
        _subLabel2.hidden = YES;
    }
    return _subLabel2;
}
-(void)configObject:(NSString *)text
{
    _titleLabel.text = text;
    if (_section == 2)
    {
        _subLabel1.hidden = NO;
        _subLabel2.hidden = NO;
    }else
    {
        _subLabel1.hidden = YES;
        _subLabel2.hidden = YES;
    }
}

@end
